﻿using Microsoft.Practices.Unity;
using MotorLibrary.DAL;
using System.Data.Entity;

namespace WebMotorTest
{
    public static class DatabaseReseter
    {
        public static void Reset()
        {
            UnityContainer resetContainer = new UnityContainer();

            resetContainer.RegisterType<IMotorDbContextFactory, MotorDbContextFactory>();
            resetContainer.RegisterType<IDatabaseInitializer<MotorDbContext>, MotorDbInitializerTest>();

            IMotorDbContextFactory resetFactory = resetContainer.Resolve<IMotorDbContextFactory>();
            using (MotorDbContext context = resetFactory.GetInstance())
            {
                context.Tipos.Find(1);
            }

        }
    }
}
